# 方法一
n = int(input())
for i in range(2, n):
    for j in range(2, i):
        if i * j == n:
            if i % j == 0:
                break  # 如果取余为0表示j是i的因子，舍去，结束本次i所在数的所有循环，用break
            else:
                print(i)


# 两个超时

# 请在此输入您的代码
def zhishu(n):
    for i in range(2, n):
        for j in range(2, i):
            if i * j == n:
                if i % j == 0:
                    break
                else:
                    return print(i)
zhishu(int(input()))